#define _CRT_SECURE_NO_WARNINGS  1
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
int my_atoi(char* buffer);
int main()
{
	int i;
	char buffer[256];
	printf("Enter a number: ");
	fgets(buffer, 256, stdin);
	i = my_atoi(buffer);
	printf("The value entered is %d. Its double is %d.\n", i, i * 2);
	return 0;
}
int my_atoi(char* buffer)
{
	int len = 0;
	int count = 0;
	while (*(buffer + len) != '\n')
		len++;
	for (int i = 0; i < len; i++)
	{
		count += (*(buffer + len - i -1) - '0') * (int)pow(10, i);
	}
	return count;
}